package cn.wolfcode.luowowo.common.util;

import cn.wolfcode.luowowo.common.exception.LogicException;

/**
 * 判断指定value是否有长度, 没有长度, 抛出异常, 异常信息 msg
 * trim()是string中的去掉空格的方法
 */
public class AssertUtil {
    public static void hasLength(String value,String msg){
        if(value==null || "".equals(value.trim())){
            throw new LogicException(msg);
        }
    }

    public static void isEquels(String password, String rpassword, String msg) {
        if(password==null || rpassword==null){
            throw new LogicException("密码不能为null");
        }
        if(!password.equals(rpassword)){
            throw new LogicException(msg);
        }
    }
}
